Microelectromechanical system (MEMS) devices such as actuators, switches, motors, sensors, variable capacitors, spatial light modulators (SLMs) and similar microelectronic devices can be manufactured on a substrate. To protect such devices, sidewalls are formed on the substrate during manufacturing to form a sealable cavity, such that structures and devices within the cavity can be relatively isolated from an outside environment. However, contaminants can gradually migrate into the cavity, and can react with or otherwise interfere with proper operation of devices included within the cavity.